// pages/my/my.js
let startY = 0;//手指起始坐标
let moveY = 0;//手指移动坐标
let moveDistance = 0;//手指移动距离
Page({

  /**
   * 页面的初始数据
   */
  data: {
    coverTransform: 'translateY(0)',
    coverTransition: '',
    List:[
      {img:"/static/images/9gg/我的.png",name:"我的"},
      {img:"/static/images/9gg/资讯.png",name:"问卷",bindtap:"questionTapswitch"},
      {img:"/static/images/9gg/任务.png",name:"任务"},
      {img:"/static/images/9gg/收藏.png",name:"收藏",bindtap:"collectionTapswitch"},
      {img:"/static/images/9gg/充值.png",name:"充值"},
      {img:"/static/images/9gg/余额.png",name:"余额"},
      {img:"/static/images/9gg/卡包.png",name:"卡包"},
      {img:"/static/images/9gg/定位.png",name:"定位",bindtap:"mapTapswitch"},
      {img:"/static/images/9gg/个人设置.png",name:"个人设置"},      
    ]    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   
  },

  questionTapswitch: function(){
    
    wx.navigateTo({
      url: '/subpackage/questionnaire/questionnaire'
    })
  // }
},
collectionTapswitch: function(){
    
  wx.navigateTo({
    url: '/subpackage/collection/collection'
  })
// }
},
  mapTapswitch: function(){
    
    wx.navigateTo({
      url: '/subpackage/map/map'
    })
  // }
},


  tapswitch: function(){
    
    wx.navigateTo({
      url: '/subpackage/focuson/focuson'
    })
  // }
},
  handleTouchStart(event){
    this.setData({
      coverTransition: ''
    })
    //起始手指坐标
    startY = event.touches[0].clientY;
  },
  handleTouchMove(event){
    moveY = event.touches[0].clientY;
    moveDistance = moveY - startY;

    if(moveDistance <= 0){
      return;
    }
    if(moveDistance >= 80){
      moveDistance = 80;
    }

    //动态更新coverTransform
    this.setData({
      coverTransform: 'translateY('+moveDistance+'rpx)'
    })
  },
  handleTouchEnd(){
        //重置coverTransform
        this.setData({
          coverTransform: 'translateY(0)',
          coverTransition: 'transform 1s linear'
        })
  },

  
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})